package templates

import org.uqbar.arena.widgets.Label
import org.uqbar.arena.widgets.List
import org.uqbar.arena.widgets.Panel
import java.awt.Color
import org.uqbar.arena.widgets.Button
import org.uqbar.lacar.ui.model.Action

class MapaYVillanoPrincipalTemplate {
	
	/** Crea un label y una lista */
	def listadoDeElementos(Panel panel, String caption,String itemsProp, String valueProp){
		new Label(panel) => [
			setText(caption)
			setBackground(Color :: LIGHT_GRAY)
			setWidth(174)
		]
		
		new List(panel) => [
				bindItemsToProperty(itemsProp)
				bindValueToProperty(valueProp)
				setWidth(150)
				setHeight(200)
		]
	}
	
	/** Crea dos label y una lista para mostrar datos. */
	def datosDe(Panel panel, String firstLabelText, String secondLabelText, String binding){
		new Label(panel) => [
			setText(firstLabelText)
		]
		
		new Label(panel) => [
			setText(secondLabelText)
			setBackground(Color :: LIGHT_GRAY)
			setWidth(174)
		]
		
		new List(panel) => [
			setWidth(150)
			setHeight(35)
			bindItemsToProperty(binding)
		]	
	}
	
	/** Crea un boton y le da una opcion. */
	def boton(Panel panel, String texto, Action action){
		new Button(panel) => [
			setCaption(texto)
			setBackground(Color ::LIGHT_GRAY)
			setWidth(174)
			onClick(action)
		]
			
	}
}